package com.gryffonx.Interfaces.timeline;

import com.gryffonx.DiceRoller.StaticDiceRoller;
import com.gryffonx.NameGenerators.TimelineEventGenerator;
import com.gryffonx.utils.SortJTableUtil;
import com.gryffonx.utils.TimelineTableCellRenderer;
import com.main.UIOptions.UIActionListeners;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

/**
 * **************************************************************************
 * Application:
 * Author: Erik Stell
 * Date: Feb 8, 2005
 * Time: 11:38:58 AM
 * Process:
 * **************************************************************************
 */
public class TimelineGeneratorBinding {
    private JPanel pnlMainPanel;
    private JTable tblTimelineTable;
    private JLabel lblEndYear;
    private JLabel lblStartYear;
    private JTextField txtStartYear;

    public JTextField getTextField1() {
        return textField1;
    }

    public void setTextField1(JTextField textField1) {
        this.textField1 = textField1;
    }

    public JComboBox getCboHowMany() {
        return cboHowMany;
    }

    public void setCboHowMany(JComboBox cboHowMany) {
        this.cboHowMany = cboHowMany;
    }

    private JTextField textField1;
    private JComboBox cboHowMany;

    public JButton getBtnLoadTimeline() {
        return btnLoadTimeline;
    }

    public void setBtnLoadTimeline(JButton btnLoadTimeline) {
        this.btnLoadTimeline = btnLoadTimeline;
    }

    private JTextField txtEndYear;
    private JPanel optionPane;
    private JScrollPane pnTbleScroller;

    private JButton btnTimelineGenerate;
    private JButton btnClearTimeline;
    private JButton btnLoadTimeline;

    public JButton getBtnClearTimeline() {
        return btnClearTimeline;
    }

    public void setBtnClearTimeline(JButton btnClearTimeline) {
        this.btnClearTimeline = btnClearTimeline;
    }

    public JButton getBtnSaveTimeline() {
        return btnSaveTimeline;
    }

    public void setBtnSaveTimeline(JButton btnSaveTimeline) {
        this.btnSaveTimeline = btnSaveTimeline;
    }

    private JButton btnSaveTimeline;

    public JButton getBtnTimelineGenerate() {
        return btnTimelineGenerate;
    }

    public void setBtnTimelineGenerate(JButton btnTimelineGenerate) {
        this.btnTimelineGenerate = btnTimelineGenerate;
    }


    public DefaultTableModel getSavedTableModel() {
        return SavedTableModel;
    }

    public void setSavedTableModel(DefaultTableModel savedTableModel) {
        SavedTableModel = savedTableModel;
    }

    private DefaultTableModel SavedTableModel;


    public JPanel getPnlMainPanel() {
        return pnlMainPanel;
    }

    public void setPnlMainPanel(JPanel pnlMainPanel) {
        this.pnlMainPanel = pnlMainPanel;
    }

    public JTable getTblTimelineTable() {
        return tblTimelineTable;
    }

    public void setTblTimelineTable(JTable tblTimelineTable) {
        this.tblTimelineTable = tblTimelineTable;
    }

    public JLabel getLblEndYear() {
        return lblEndYear;
    }

    public void setLblEndYear(JLabel lblEndYear) {
        this.lblEndYear = lblEndYear;
    }

    public JLabel getLblStartYear() {
        return lblStartYear;
    }

    public void setLblStartYear(JLabel lblStartYear) {
        this.lblStartYear = lblStartYear;
    }

    public JTextField getTxtStartYear() {
        return txtStartYear;
    }

    public void setTxtStartYear(JTextField txtStartYear) {
        this.txtStartYear = txtStartYear;
    }

    public JTextField getTxtEndYear() {
        return txtEndYear;
    }

    public void setTxtEndYear(JTextField txtEndYear) {
        this.txtEndYear = txtEndYear;
    }

    public JPanel getOptionPane() {
        return optionPane;
    }

    public void setOptionPane(JPanel optionPane) {
        this.optionPane = optionPane;
    }

    public JScrollPane getPnTbleScroller() {
        return pnTbleScroller;
    }

    public void setPnTbleScroller(JScrollPane pnTbleScroller) {
        this.pnTbleScroller = pnTbleScroller;
    }

    public TimelineGeneratorBinding() {

        //set the default model for the table
        Object[] colName = new Object[2];
        colName[0] = "Year";
        colName[1] = "Event";

        TimelineTableCellRenderer cellRenderer = new TimelineTableCellRenderer();
        SavedTableModel = new DefaultTableModel(colName, 0);

        tblTimelineTable.setRowSelectionAllowed(true);
        tblTimelineTable.setColumnSelectionAllowed(true);

        tblTimelineTable.setModel(SavedTableModel);

        TableColumnModel colModel = tblTimelineTable.getColumnModel();
        colModel.getColumn(0).setPreferredWidth(50);
        colModel.getColumn(0).setCellRenderer(cellRenderer);
        colModel.getColumn(1).setPreferredWidth(350);
        colModel.getColumn(1).setCellRenderer(cellRenderer);

        //register action listeners
        btnTimelineGenerate.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {

            }
        });

        btnTimelineGenerate.addKeyListener(new KeyListener() {
            public void keyPressed(KeyEvent e) {

            }

            public void keyReleased(KeyEvent e) {
            }

            public void keyTyped(KeyEvent e) {
            }

        });
        txtStartYear.addKeyListener(new KeyListener() {
            public void keyPressed(KeyEvent e) {

            }

            public void keyReleased(KeyEvent e) {
            }

            public void keyTyped(KeyEvent e) {
            }

        });
        txtEndYear.addKeyListener(new KeyListener() {
            public void keyPressed(KeyEvent e) {

            }

            public void keyReleased(KeyEvent e) {
            }

            public void keyTyped(KeyEvent e) {
            }

        });


    }


}
